package com.jerry.springboot.tasks;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TestScheduleTask {

	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

	//表达式生成地址：http://cron.qqe2.com
//  @Scheduled(fixedRate = 3000)     // 定义每隔3秒，执行任务
//	@Scheduled(cron = "4-40 * * * * ?")   //定义4秒到40秒时，执行任务
    public void reportCurrentTime() {
        System.out.println("现在时间：" + dateFormat.format(new Date()));
    }
}
